<template>
  <div>
    <div class="home-box box-3-list">
      <div class="center-box1">
        <div class="box-title-1">
          <img src="@/assets/image/5.webp" alt="">
          <div class="center">
            <p>红娘推荐优质会员</p>
            <p>TA们都在寻爱，你还在等什么？</p>
          </div>
        </div>
        <div class="box-2-nav">
          <div class="box-item" v-loading="loading" v-if="userList.length>0" v-for="(item,index) in userList" :key="index">
            <img class="image" :src="item.icon" alt="">
            <div class="nav">
                <span class="left-icon">
                  <i class="el-icon-s-opportunity"></i> {{ item.realName }}
                </span>
              <span class="left-icon">
                  {{item.birthday ? parseTime(item.birthday) : '暂无数据'}}
                </span>
            </div>
            <div class="nav">
                <span class="left-icon">
                  <i class="el-icon-location"></i> {{item.remake}}
                </span>
              <span class="left-icon">
                 {{item.note}}元/月
                </span>
            </div>
            <div class="nav-content">
              {{ item.habits }}
            </div>

            <a class="btn" href="javascript:void (0)" @click="submitForm(item)">给TA发消息</a>
          </div>
          <el-empty v-else></el-empty>
        </div>
        <div class="box-bottom">
          <el-pagination
              large
              background
              @current-change="changePages"
              layout="prev, pager, next"
              :total="total">
          </el-pagination>
        </div>

      </div>
    </div>



    <lz-footer></lz-footer>
  </div>
</template>

<script>
import {followMembers, getAllUser, getDatEventList} from "@/api/apiFox";
import {parseTime} from "../../utils";

export default {
  data(){
    return{
      dialogVisible:false,
      loading:false,
      userList:[],
      total:100,
      queryParams:{
        pageNum:1,
        role:2,
        pageSize:10
      }
    }
  },
  methods:{
    parseTime,
    handleClose(){
      this.dialogVisible=false
    },
    changePages(e){
      console.log(e)
      this.queryParams.pageNum = e
      this.getList(this.queryParams)
    },
    getList(queryParams){
      getAllUser(queryParams).then(res=>{
        this.userList = res.list
        this.queryParams.pageNum = res.pageNum
        this.queryParams.pageSize = res.pageSize
        this.total = res.totalCount
      }).catch(err=>{})
    },
    submitForm(item){
      console.log(item)
      this.loading=true
      followMembers({userId:item.id}).then(res=>{
        this.$message.success('已关注')
        this.loading=false
        setTimeout(()=>{
          this.$router.push({path:'/chat',query:{id:item.id}}).catch(err=>{})
        },1000)

      }).catch(err=>{})

    }
  },


  mounted() {
    this.getList(this.queryParams)
  }
}
</script>

<style scoped lang="scss">
.home-box{
  width: 100%;
  min-height: calc(100vh - 140px);
  background:var(--homeBgk);
  display: flex;
  justify-content: center;
  .home-center{
    width: 1200px;
    min-height: calc(100vh - 140px);
    display: flex;
    justify-content: space-between;
    //background: #fff;
    .left{
      width: 600px;
      padding-top: 20vh;
      box-sizing: border-box;
      .logo{
        margin: 10px 0;
      }
      .title{
        font-size: 36px;
        font-weight: 400;
        //text-align: center;
        color: var(--textColor);
      }
      .content{
        font-size: 14px;
        margin-top: 15px;
        color: var(--colorTip);
      }
      .btn{
        width: 100%;
        margin-top: 30px;
        a{
          display: flex;
          align-items: center;
          justify-content: center;
          width: 150px;
          font-size: 14px;
          height: 45px;
          color: #fff;
          background: #333;
          border-radius: 10px;
        }
      }
    }
    .right{
      width: 800px;
      margin-right: -200px;
    }
  }
}
.box-nav-list{
  background: var(--navBgk);
  height: 200px !important;
  margin-bottom: -200px;
  .home0-center{
    width: 1200px;
    padding-top: 120px;
    display: flex;
    height: 200px;
    justify-content: space-between;
    .item{
      margin-left: 30px;
      width: 300px;
      height: 300px;
      text-align: center;
      .nav-box{
        width: 100%;
        height: 120px;
        border-radius: 50%;
        img{
          width: 100px;
          height: 100px;
          object-fit: cover;
        }
      }
      .title{
        font-size: 22px;
        color: var(--textColor);
        font-weight: 600;
      }
      .box-center{
        margin-top: 15px;
        font-size: 12px;
        color: var(--colorTip);
      }
    }
  }
}
.box-3-list{
  width: 100%;
  background: var(--navBgk);
  padding-bottom: 150px;
  padding-top: 45px;
  .center-box1{
    width: 1300px;
    .box-title-1{
      width: 100%;
      text-align: center;
      position: relative;
      .center{
        width: 100%;
        position: absolute;
        margin-top: -30px;
        p:nth-child(1){
          font-size: 28px;
          font-weight: 600;
          color: #fc476d;
        }
        p:nth-child(2){
          font-size: 12px;
          color: var(--colorTip);
        }
      }
    }
    .box-2-nav{
      width: 100%;
      margin-top: 100px;
      display: flex;
      //justify-content: space-between;
      flex-wrap: wrap;
      .box-item{
        margin-right: 30px;
        margin-bottom: 25px;
        width: 278px;
        min-height: 480px;
        background: var(--itemBgk);
        //border-radius: 10px;
        overflow: hidden;
        padding: 10px;
        box-sizing: border-box;
        box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
        .image{
          width: 100%;
          height: 250px;
          object-fit: cover;
        }
        .nav{
          width: 100%;
          margin-top: 15px;
          display:  flex;
          justify-content: space-between;
          .left-icon{
            font-size: 14px;
            color: var(--navCircle);
            i{
              color: #fc476d;
            }
          }
        }
        .nav-content{
          font-size: 14px;
          margin-top: 10px;
          color: var(--colorTip);
        }
        .btn{
          width: 100%;
          height: 40px;
          display: flex;
          justify-content: center;
          margin-top: 18px;
          align-items: center;
          border: 1px solid var(--switchBorder);
          color: var(--activeColor);
        }
      }
      .box-item-length{
        width: 48%;
        margin: 10px 0;
        min-height: 150px;
        padding: 10px;
        background: var(--itemBgk);
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
        .img-left{
          width: 220px;
          height: 220px;
          object-fit: cover;
        }
        .right-box{
          width: calc(100% - 220px);
          margin-left: 15px;
          padding-top: 15px;
          box-sizing: border-box;
          .titles{
            font-weight: 600;
            font-size: 18px;
            color: var(--navCircle);
          }
          .time{
            font-size: 16px;
            color: var(--navCircle);
            margin-top: 10px;
          }
          .btn-bot{
            margin-top: 20px;
            width: 200px;
            height: 42px;
            border-radius: 5px;
            background: var(--activeColor);
            color: var(--navBgk);
            font-size: 14px;
            display: flex;
            justify-content: center;
            align-items: center;
          }
        }
      }
    }
    .box-bottom{
      width: 100%;
      display: flex;
      justify-content: center;
      margin-top: 30px;
    }
  }
}
</style>
